package Components;

import java.util.Iterator;

import mainWindow.main;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

import DataDefinition.Users;

public class chooseUser extends Composite {
	Combo combo;

	/**
	 * Create the composite.
	 * @param parent
	 * @param style
	 */
	public chooseUser(Composite parent, int style) {
		super(parent, style);
		
		
		combo = new Combo(this, SWT.NONE);
		if(!main.getUzivatelov().isEmpty())
			for(Iterator<Users> it =main.getUzivatelov().iterator();it.hasNext();)
				combo.add(it.next().getName() + " " + it.next().getSurName());
		
		combo.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				System.out.println(combo.getSelectionIndex());
				
			}
		});
		combo.setBounds(10, 10, 93, 21);

	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}
}
